home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / LocationManager.a < prev    next >
Encoding:
Text File  |  1998-02-12  |  11.0 KB  |  355 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        LocationManager.a
  3. ;
  4. ;    Contains:    LocationManager (old name; use SettingsManager instead)
  5. ;
  6. ;    Version:    Technology:    Mac OS 8
  7. ;                Release:    Universal Interfaces 3.1
  8. ;
  9. ;    Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__LOCATIONMANAGER__') = 'UNDEFINED' THEN
  19. __LOCATIONMANAGER__ SET 1
  20.  
  21.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  22.     include 'AppleEvents.a'
  23.     ENDIF
  24.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  25.     include 'Components.a'
  26.     ENDIF
  27.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  28.     include 'Dialogs.a'
  29.     ENDIF
  30.     IF &TYPE('__PROCESSES__') = 'UNDEFINED' THEN
  31.     include 'Processes.a'
  32.     ENDIF
  33.     IF &TYPE('__STANDARDFILE__') = 'UNDEFINED' THEN
  34.     include 'StandardFile.a'
  35.     ENDIF
  36.  
  37. ;  Location Manager API Support -------------------------------------------------------------------- 
  38. ;  A Location Token uniquely identifies a Location on a machine... 
  39.  
  40.  
  41.  
  42.  
  43. kALMNoLocationToken                EQU        -1                    ; ALMToken of "off" Location...
  44.  
  45. kALMLocationNameMaxLen            EQU        31                    ; name (actually imposed by file system)... 
  46. kALMNoLocationIndex                EQU        -1                    ; index for the "off" Location (kALMNoLocationToken)... 
  47. ALMLocationName            RECORD 0
  48. f                         ds        Str31
  49. sizeof                     EQU *                    ; size:   $20 (32)
  50.                         ENDR
  51.  
  52.  
  53. ;  Returned from ALMConfirmName... 
  54. ; typedef SInt16                         ALMConfirmChoice
  55.  
  56.  
  57. kALMConfirmRename                EQU        1
  58. kALMConfirmReplace                EQU        2
  59. ;  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)... 
  60.  
  61.  
  62. kALMDuplicateRenameButton        EQU        1                    ; if Window refcon is kALMDuplicateDialogRefCon... 
  63. kALMDuplicateReplaceButton        EQU        2
  64. kALMDuplicateCancelButton        EQU        3
  65. kALMDuplicatePromptText            EQU        5
  66.  
  67. kALMRenameRenameButton            EQU        1                    ; if Window refcon is kALMRenameDialogRefCon... 
  68. kALMRenameCancelButton            EQU        2
  69. kALMRenameEditText                EQU        3
  70. kALMRenamePromptText            EQU        4
  71. ;  Refcons of two windows in ALMConfirmName (ALM 2.0)... 
  72.  
  73.  
  74. kALMDuplicateDialogRefCon        EQU        'dupl'
  75. kALMRenameDialogRefCon            EQU        'rnam'
  76. ;  Callback routine for Location awareness (mimics AppleEvents) in non-application code... 
  77.  
  78. ;  Notification AppleEvents sent to apps/registered code...  
  79.  
  80. kAELocationChangedNoticeKey        EQU        'walk'                ; Current Location changed... 
  81. kAELocationRescanNoticeKey        EQU        'trip'                ; Location created/renamed/deleted... 
  82. ;  ALMSwitchToLocation masks... 
  83.  
  84. ; typedef SInt32                         ALMSwitchActionFlags
  85.  
  86.  
  87. kALMDefaultSwitchFlags            EQU        $00000000            ; No special action to take... 
  88. kALMDontShowStatusWindow        EQU        $00000001            ; Suppress "switching" window... 
  89. kALMSignalViaAE                    EQU        $00000002            ; Switch by sending Finder AppleEvent... 
  90. ;  Parameters for Get/Put/Merge Location calls... 
  91.  
  92. ; typedef const OSType *                ConstALMModuleTypeListPtr
  93.  
  94.  
  95. kALMAddAllOnSimple                EQU        0                    ; Add all single-instance, non-action modules... 
  96. kALMAddAllOff                    EQU        -1                    ; Add all modules but turn them off... 
  97. ;  Item numbers for use in Get/Put/Merge Location filters... 
  98.  
  99.  
  100. kALMLocationSelectButton        EQU        1
  101. kALMLocationCancelButton        EQU        2
  102. kALMLocationBalloonHelp            EQU        3
  103. kALMLocationLocationList        EQU        7
  104. kALMLocationLocationNameEdit    EQU        10
  105. kALMLocationPromptText            EQU        11
  106.  
  107. kALMLocationSaveButton            EQU        1
  108. ;  Location Manager Module API Support ------------------------------------------------------------- 
  109.  
  110. ;  ALMGetScriptInfo stuff... 
  111.  
  112.  
  113. kALMScriptInfoVersion            EQU        2                    ; Customarily put in resource for localization... 
  114. ALMScriptManagerInfo    RECORD 0
  115. version                     ds.w    1                ; offset: $0 (0)        ;  Set to kALMScriptInfoVersion... 
  116. scriptCode                 ds.w    1                ; offset: $2 (2)
  117. regionCode                 ds.w    1                ; offset: $4 (4)
  118. langCode                 ds.w    1                ; offset: $6 (6)
  119. fontNum                     ds.w    1                ; offset: $8 (8)
  120. fontSize                 ds.w    1                ; offset: $A (10)
  121. sizeof                     EQU *                    ; size:   $C (12)
  122.                         ENDR
  123. ; typedef struct ALMScriptManagerInfo *    ALMScriptManagerInfoPtr
  124.  
  125.  
  126. ;   Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  127. ;   samples and internally, so....
  128.  
  129.  
  130. ALMAltScriptManagerInfo    RECORD 0
  131. version                     ds.w    1                ; offset: $0 (0)
  132. scriptCode                 ds.w    1                ; offset: $2 (2)
  133. regionCode                 ds.w    1                ; offset: $4 (4)
  134. langCode                 ds.w    1                ; offset: $6 (6)
  135. fontSize                 ds.w    1                ; offset: $8 (8)
  136. fontName                 ds        Str63            ; offset: $A (10)
  137. sizeof                     EQU *                    ; size:   $4A (74)
  138.                         ENDR
  139. ; typedef struct ALMAltScriptManagerInfo * ALMAltScriptManagerInfoPtr
  140.  
  141. ; typedef ALMAltScriptManagerInfoPtr *    ALMAltScriptManagerInfoHandle
  142.  
  143.  
  144. kALMAltScriptManagerInfoRsrcType EQU    'trip'
  145. kALMAltScriptManagerInfoRsrcID    EQU        0
  146. ;  Reboot information used on ALMSetCurrent (input/output parameter)... 
  147.  
  148. ; typedef UInt32                         ALMRebootFlags
  149.  
  150.  
  151. kALMNoChange                    EQU        0
  152. kALMAvailableNow                EQU        1
  153. kALMFinderRestart                EQU        2
  154. kALMProcesses                    EQU        3
  155. kALMExtensions                    EQU        4
  156. kALMWarmBoot                    EQU        5
  157. kALMColdBoot                    EQU        6
  158. kALMShutdown                    EQU        7
  159.  
  160. ;   File types and signatures...
  161. ;   Note: auto-routing of modules will not be supported for 'thng' files...
  162.  
  163.  
  164.  
  165.  
  166. kALMFileCreator                    EQU        'fall'                ; Creator of Location Manager files... 
  167. kALMComponentModuleFileType        EQU        'thng'                ; Type of a Component Manager Module file [v1.0]... 
  168. kALMComponentStateModuleFileType EQU    'almn'                ; Type of a CM 'state' Module file... 
  169. kALMComponentActionModuleFileType EQU    'almb'                ; Type of a CM 'action' Module file... 
  170. kALMCFMStateModuleFileType        EQU        'almm'                ; Type of a CFM 'state' Module file... 
  171. kALMCFMActionModuleFileType        EQU        'alma'                ; Type of a CFM 'action' Module file... 
  172. ;  Component Manager 'thng' info... 
  173.  
  174.  
  175. kALMComponentRsrcType            EQU        'thng'
  176. kALMComponentType                EQU        'walk'
  177. ;  CFM Modules require a bit of information (replacing some of the 'thng' resource)... 
  178.  
  179.  
  180. kALMModuleInfoRsrcType            EQU        'walk'
  181. kALMModuleInfoOriginalVersion    EQU        0
  182. ;  These masks apply to the "Flags" field in the 'thng' or 'walk' resource... 
  183.  
  184.  
  185. kALMMultiplePerLocation            EQU        $00000001            ; Module can be added more than once to a Location... 
  186. kALMDescriptionGetsStale        EQU        $00000002            ; Descriptions may change though the setting didn't...  
  187. ;  Misc stuff for older implementations ------------------------------------------------------------ 
  188.  
  189.     IF OLDROUTINENAMES THEN
  190. ;  Old error codes for compatibility - new names are in Errors interface... 
  191.  
  192. ALMInternalErr                    EQU        -30049                ; use kALMInternalErr 
  193. ALMLocationNotFound                EQU        -30048                ; use kALMLocationNotFoundErr 
  194. ALMNoSuchModuleErr                EQU        -30047                ; use kALMNoSuchModuleErr 
  195. ALMModuleCommunicationErr        EQU        -30046                ; use kALMModuleCommunicationErr 
  196. ALMDuplicateModuleErr            EQU        -30045                ; use kALMDuplicateModuleErr 
  197. ALMInstallationErr                EQU        -30044                ; use kALMInstallationErr 
  198. ALMDeferSwitchErr                EQU        -30043                ; use kALMDeferSwitchErr 
  199. ;  Old ALMConfirmName constants... 
  200.  
  201.  
  202. ALMConfirmRenameConfig            EQU        1
  203. ALMConfirmReplaceConfig            EQU        2
  204. ;  Old AppleEvents... 
  205.  
  206.  
  207. kAELocationNotice                EQU        'walk'
  208. ALMScriptMgrInfo        RECORD 0
  209. f                         ds        ALMScriptManagerInfo
  210. sizeof                     EQU *                    ; size:   $C (12)
  211.                         ENDR
  212.  
  213.  
  214. ; typedef UInt32                         ALMComponentFlagsEnum
  215.  
  216.     ENDIF    ; OLDROUTINENAMES
  217. ;  Location Manager API ---------------------------------------------------------------------------- 
  218.  
  219. ;  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set... 
  220.  
  221. ;
  222. ; pascal OSErr ALMGetCurrentLocation(SInt16 *index, ALMToken *token, ALMLocationName name)
  223. ;
  224.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  225.         Macro
  226.         _ALMGetCurrentLocation
  227.             move.w              #$0600,D0
  228.             dc.w                $AAA4
  229.         EndM
  230.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  231.         IMPORT_CFM_FUNCTION ALMGetCurrentLocation
  232.     ENDIF
  233.  
  234. ;
  235. ; pascal OSErr ALMGetIndLocation(SInt16 index, ALMToken *token, ALMLocationName name)
  236. ;
  237.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  238.         Macro
  239.         _ALMGetIndLocation
  240.             move.w              #$0501,D0
  241.             dc.w                $AAA4
  242.         EndM
  243.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  244.         IMPORT_CFM_FUNCTION ALMGetIndLocation
  245.     ENDIF
  246.  
  247. ;
  248. ; pascal OSErr ALMCountLocations(SInt16 *locationCount)
  249. ;
  250.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  251.         Macro
  252.         _ALMCountLocations
  253.             move.w              #$0202,D0
  254.             dc.w                $AAA4
  255.         EndM
  256.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  257.         IMPORT_CFM_FUNCTION ALMCountLocations
  258.     ENDIF
  259.  
  260. ;
  261. ; pascal OSErr ALMSwitchToLocation(ALMToken newLocation, ALMSwitchActionFlags switchFlags)
  262. ;
  263.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  264.         Macro
  265.         _ALMSwitchToLocation
  266.             move.w              #$0403,D0
  267.             dc.w                $AAA4
  268.         EndM
  269.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  270.         IMPORT_CFM_FUNCTION ALMSwitchToLocation
  271.     ENDIF
  272.  
  273. ;
  274. ; pascal OSErr ALMRegisterNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  275. ;
  276.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  277.         Macro
  278.         _ALMRegisterNotifyProc
  279.             move.w              #$0404,D0
  280.             dc.w                $AAA4
  281.         EndM
  282.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  283.         IMPORT_CFM_FUNCTION ALMRegisterNotifyProc
  284.     ENDIF
  285.  
  286. ;
  287. ; pascal OSErr ALMRemoveNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  288. ;
  289.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  290.         Macro
  291.         _ALMRemoveNotifyProc
  292.             move.w              #$0405,D0
  293.             dc.w                $AAA4
  294.         EndM
  295.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  296.         IMPORT_CFM_FUNCTION ALMRemoveNotifyProc
  297.     ENDIF
  298.  
  299. ;
  300. ; pascal OSErr ALMConfirmName(ConstStr255Param message, Str255 theName, ALMConfirmChoice *choice, ModalFilterUPP filter)
  301. ;
  302.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  303.         Macro
  304.         _ALMConfirmName
  305.             move.w              #$0806,D0
  306.             dc.w                $AAA4
  307.         EndM
  308.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  309.         IMPORT_CFM_FUNCTION ALMConfirmName
  310.     ENDIF
  311.  
  312. ;  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set... 
  313.  
  314. ;
  315. ; pascal OSErr ALMPutLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  316. ;
  317.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  318.         Macro
  319.         _ALMPutLocation
  320.             move.w              #$0B07,D0
  321.             dc.w                $AAA4
  322.         EndM
  323.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  324.         IMPORT_CFM_FUNCTION ALMPutLocation
  325.     ENDIF
  326.  
  327. ;
  328. ; pascal OSErr ALMGetLocation(ConstStr255Param prompt, ALMLocationName name, ModalFilterYDUPP filter, void *yourDataPtr)
  329. ;
  330.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  331.         Macro
  332.         _ALMGetLocation
  333.             move.w              #$0808,D0
  334.             dc.w                $AAA4
  335.         EndM
  336.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  337.         IMPORT_CFM_FUNCTION ALMGetLocation
  338.     ENDIF
  339.  
  340. ;
  341. ; pascal OSErr ALMMergeLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  342. ;
  343.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  344.         Macro
  345.         _ALMMergeLocation
  346.             move.w              #$0B09,D0
  347.             dc.w                $AAA4
  348.         EndM
  349.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  350.         IMPORT_CFM_FUNCTION ALMMergeLocation
  351.     ENDIF
  352.  
  353.     ENDIF ; __LOCATIONMANAGER__ 
  354.  
  355.